home *** CD-ROM | disk | FTP | other *** search
- #define OLDROUTINENAMES 0
- #define OLDROUTINELOCATIONS 0
- #define SystemSevenFiveOrLater 1
- /* #include files */
-
- #include <QuickDraw.h>
- #include <Memory.h>
- #include <Resources.h>
- #include <OSUtils.h>
- #include <Traps.h>
- #include <Gestalt.h>
- #include <A4Stuff.h>
- #include <SetupA4.h>
-
- /* #defines */
- #define assert(i) if ((i) DebugStr("\p;printf \"assertion failed file %s line %d\" __FILE__, __LINE__")
-
- #define kINITid 0
- #define kICONid 128
- #define kSuccessid 130
- #define kFailid 131
-
- pascal void ShowIcon7(short iconId, Boolean advance);
- void InitMask(unsigned char *theMask);
-
- /* RGBBackColor patch stuff */
-
- pascal void RGBBackColorPatch(const RGBColor *color);
-
- typedef pascal void (*RGBBackColorProc)(const RGBColor *color);
- RGBBackColorProc gOldRGBBackColorAddr;
-
- /* globals */
-
- OSType gIconTypes[] = {
- 'ICN#',
- 'ics#',
- 'icl8',
- 'icl4',
- 'ics8',
- 'ics4'
- };
- #define kICONArraySize (sizeof(gIconTypes)-sizeof(OSType))
-
- unsigned char ICN[(32/8)*32];
- unsigned char ics[(16/8)*16];
- unsigned char icl8[(32/8)*32*8];
- unsigned char ics8[(16/8)*16*8];
- unsigned char icl4[(32/8)*32*4];
- unsigned char ics4[(16/8)*16*4];
-
- unsigned char mask[(32/8)*32]; // maximum size mask used for any of the above.
-
- /* main */
-
- void main(void)
- {
- long oldA4;
- Handle h;
- Boolean goOn = true;
-
- #ifdef USE_DEBUGGER_CALLS
- Debugger();
- #endif
-
- /* set up our A4 context for _this file_ */
- oldA4 = SetCurrentA4();
- RememberA4();
-
- ShowIcon7(kSuccessid, false);
-
- /* detach ourselves */
- h = Get1Resource('INIT', kINITid);
- if (h) DetachResource(h);
- else goOn = false;
-
- /* initialize the globals in _this file_ */
- gOldRGBBackColorAddr = 0L;
-
- if (goOn)
- {
- /* patch RGBBackColor */
- gOldRGBBackColorAddr = (RGBBackColorProc)NGetTrapAddress(_RGBBackColor, ToolTrap);
- NSetTrapAddress((UniversalProcPtr)RGBBackColorPatch, _RGBBackColor, ToolTrap);
- }
-
- if (goOn) ShowIcon7(kSuccessid, true);
- else ShowIcon7(kFailid, true);
-
- /* restore the a4 world */
- SetA4(oldA4);
- }
-
-
- /* RGBBackColorPatch */
-
- pascal void
- RGBBackColorPatch(const RGBColor *color)
- {
- long oldA4;
- RGBColor noGrey;
-
- #ifdef USE_DEBUGGER_CALLS
- Debugger();
- #endif
-
- /* use the global data in _this file_ */
- oldA4 = SetUpA4();
-
- noGrey.red = noGrey.green = noGrey.blue = 0xFFFF;
-
- /* a _useful_ hack would check that you are in the Finder (check CurApName) */
-
- if ((color->red == 0xDDDD) && (color->green == 0xDDDD) && (color->blue == 0xDDDD))
- {
- gOldRGBBackColorAddr(&noGrey);
- }
- else
- {
- /* call through to the original RGBBackColor */
- gOldRGBBackColorAddr(color);
- }
-
- /* restore the a4 world */
- RestoreA4(oldA4);
- }
-
-